import request from '@/router/axios';
import {downloadExcel} from '@/router/axios';
import {formatCondition} from '@/util/util';
//单条查询
export const queryGeneralFlowInfo = (params) => {
  params.head.transCode = 'queryGeneralFlowInfo';
  return request({
    url: '/general/generalFlowInfo/queryGeneralFlowInfo',
    method: 'post',
    data: params
  })
}
//多条列表查询，支持条件查询
export const queryGeneralFlowInfoListPage = (params) => {
  params.head.transCode = 'queryGeneralFlowInfoListPage';
  return request({
    url: '/general/generalFlowInfo/queryGeneralFlowInfoListPage',
    method: 'post',
    data: params
  })
}
//新增单条记录
export const saveGeneralFlowInfo = (params) => {
  params.head.transCode = 'saveGeneralFlowInfo';
  return request({
    url: '/general/generalFlowInfo/saveGeneralFlowInfo',
    method: 'post',
    data: params
  })
}
//新增多条记录
export const saveGeneralFlowInfoList = (params) => {
  params.head.transCode = 'saveGeneralFlowInfoList';
  return request({
    url: '/general/generalFlowInfo/saveGeneralFlowInfoList',
    method: 'post',
    data: params
  })
}
//新增或修改单条记录
export const saveOrUpdateGeneralFlowInfo = (params) => {
  params.head.transCode = 'saveOrUpdateGeneralFlowInfo';
  return request({
    url: '/general/generalFlowInfo/saveOrUpdateGeneralFlowInfo',
    method: 'post',
    data: params
  })
}


//新增或修改单条记录
export const saveOrUpdateGeneralFlowInfoList = (params) => {
  params.head.transCode = 'saveOrUpdateGeneralFlowInfoList';
  return request({
    url: '/general/generalFlowInfo/saveOrUpdateGeneralFlowInfoList',
    method: 'post',
    data: params
  })
}

//修改单条记录
export const updateGeneralFlowInfo = (params) => {
  params.head.transCode = 'updateGeneralFlowInfo';
  return request({
    url: '/general/generalFlowInfo/updateGeneralFlowInfo',
    method: 'post',
    data: params
  })
}

//删除单条记录
export const deleteGeneralFlowInfo = (params) => {
  params.head.transCode = 'deleteGeneralFlowInfo';
  return request({
    url: '/general/generalFlowInfo/deleteGeneralFlowInfo',
    method: 'post',
    data: params
  })
}

//删除多条记录
export const deleteGeneralFlowInfoList = (params) => {
  params.head.transCode = 'deleteGeneralFlowInfoList';
  return request({
    url: '/general/generalFlowInfo/deleteGeneralFlowInfoList',
    method: 'post',
    data: params
  })
}
//导出excel
export const exportGeneralFlowInfoExcel = (params) => {
  downloadExcel({
    url: '/general/generalFlowInfo/excelDownload/exportGeneralFlowInfoExcel',
    method: 'get',
    data: 
    {
      tenantId: params.head.tenantId,
      orders:'',
      condition: formatCondition(params.body.sqlCondition)
    }
  })
}

//获取流程图数据
export const getFlowChartData = (params) => {
  params.head.transCode = 'getFlowChartData';
  return request({
    url: '/general/generalFlowInfo/getFlowChartData',
    method: 'post',
    data: params
  })
}